package com.lehecai.core.api.event;

import com.lehecai.core.IntegerBeanLabelItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangzq on 14-11-14.
 */
public class SelectLotteryType extends IntegerBeanLabelItem {

    private static final Logger logger = LoggerFactory.getLogger(PropType.class.getName());

    private static List<SelectLotteryType> items = new ArrayList<SelectLotteryType>();
    private static List<SelectLotteryType> queryItems = new ArrayList<SelectLotteryType>();

    protected SelectLotteryType(String name, int value, boolean queryOnly) {
        super(SelectLotteryType.class.getName(), name, value);
        queryItems.add(this);
        if (!queryOnly) {
            items.add(this);
        }
    }

    protected SelectLotteryType(String name, int value) {
        this(name, value, false);
    }

    public static SelectLotteryType getItem(int value){
        try {
            return (SelectLotteryType) SelectLotteryType.getResult(SelectLotteryType.class.getName(), value);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        }
    }

    public static List<SelectLotteryType> getItems() {
        return items;
    }

    public static List<SelectLotteryType> getQueryItems() {
        return queryItems;
    }

    public static final SelectLotteryType ALL = new SelectLotteryType("全部", -1, true);
    public static final SelectLotteryType SZC = new SelectLotteryType("数字彩", 0);
    public static final SelectLotteryType GPC = new SelectLotteryType("高频彩", 1);
    public static final SelectLotteryType JJC = new SelectLotteryType("竞技彩", 2);
}
